package com.zijie.shoprbacapi.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zijie.rbac.model.UserGroup;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserGroupMapper extends BaseMapper<UserGroup> {

      Page<UserGroup> findAll(Page<UserGroup> page, UserGroup usb);
     @Update("update user set user_group_id = #{userGroupId} where id = #{adminId}")
    boolean assignAdminToGroup(Long adminId, Long userGroupId);

    @Update("update t_rbac_group set role_id = #{roleId} where id = #{userGroupId}")
    void assignRole(Long userGroupId, Long roleId);
}
